<?php
require_once 'MyPDO.php';
require_once 'PreparationREQ.php';

try {

$db = new MyPDO('mysql:host=mysql1.alwaysdata.com;dbname=ppe3usep_bd','ppe3usep','ppe3usep');
echo "Connexion reussie\n\n";
//Mail : h_theotim@live.fr
//Pass : ppe3usep
//id BDD : ppe3usep_bd

$PrepREQ = new PreparationREQ($db);

//affichage des donnees avant modification
print_r($PrepREQ->selectAll());


if (isset($_POST['nom'])&& isset($_POST['mdp'])&& isset($_POST['email'])&& isset($_POST['tel']))
{
	if (!empty($_POST['nom'])&& !empty($_POST['mdp'])&& !empty($_POST['email'])&&!empty($_POST['tel']))
	{
		$PrepREQ->insertEcole($_POST['nom'],$_POST['mdp'],$_POST['email'],$_POST['tel']);
	}	
	else 
	{
		echo "Pas d'acceptation de valeur vide\n\n";
	}	
}
else
{
	echo " Il faut passer par le formulaire ";
}


//affichage en brut des donn�es issues de la BD gr�ce au print_r (echo �volu�)
print_r($PrepREQ->selectById(1));
print_r($PrepREQ->selectByName('u'));


} catch (Exception $e) {
die("Impossible de se connecter: " . $e->getMessage());
}

?>
